package com.wc.alorithm_blue_bridge._思维.Q1447;

import java.util.HashSet;
import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/10/12 19:33
 * @description 砝码称重
 * https://www.lanqiao.cn/problems/1447/learning/?page=2&first_category_id=1&sort=students_count&second_category_id=3
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
//        int n = 100;
        int[] array = new int[n];

        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
//            array[i] = i+1;
        }

        Main main = new Main();
        HashSet<Integer> ansStock = new HashSet<>();
//        main.balance(ansStock, 0, 0, 0, array);

        ansStock.add(0);
        for (int i = 0; i < n; i++) {
            HashSet<Integer> ansStockTmp = new HashSet<>();
            for (int num : ansStock) {
                ansStockTmp.add(Math.abs(num + array[i]));
                ansStockTmp.add(Math.abs(num - array[i]));
                ansStockTmp.add(num);
            }
            ansStock = ansStockTmp;
        }
        System.out.println(ansStock.size() - 1);
    }

    /**
     * 递归会超时
     *
     * @param ans
     * @param left
     * @param right
     * @param index
     * @param array
     */
    public void balance(HashSet<Integer> ans, int left, int right, int index, int[] array) {
        if (left != right) {
            ans.add(Math.abs(left - right));
        }
        if (index == array.length) {
            return;
        }
        /**
         * 不放
         */
        balance(ans, left, right, index + 1, array);
        /**
         * 放左边
         */
        balance(ans, left + array[index], right, index + 1, array);
        /**
         * 放右边
         */
        balance(ans, left, right + array[index], index + 1, array);
    }
}
